using System;
using NHibernate.Criterion;

namespace FwkLight.Domain.Fetching
{
  public class FetchingFilterIsNull : FetchingFilter
  {
    public FetchingFilterIsNull ( string propertyName, IFetchingPart parent )
      : base(propertyName, null, parent)
    {
    }

    public override void ApplyFilterOn ( DetachedCriteria criteria )
    {
      criteria.Add(Restrictions.IsNull(Parent.Alias + "." + PropertyName));
    }
  }
}